package com.example.springboot01.testScope;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import java.util.Random;

/**
 * @author keyer
 * @Description : 测试原型模式的bean，非单例，每次调用产生一个新的bean
 * Created by cyd on 2021-04-30 14:39:45
 */
@Service
@Scope("prototype")
public class DemoPrototypeService {
    private final Integer numRandom = new Random().nextInt();

    public void print() {
        System.out.println("hello,i am a Prototype,and i have a num: " + numRandom);
    }

}
